package com.wswy.wzcx.model.core

import com.google.gson.annotations.SerializedName
import java.io.File

class OSSToken(

        @SerializedName("endPoint") val endpoint: String? = null,

        @SerializedName("accessKeyId") val accessKeyId: String? = null,

        @SerializedName("accessKeySecret") val secretKeyId: String? = null,

        @SerializedName("securityToken") val securityToken: String? = null,

        @SerializedName("bucketName") val bucketName: String? = null,

        @SerializedName("uploadDir") val uploadDir: String? = null


) {


    fun isInvalid(): Boolean {
        return endpoint.isNullOrEmpty() || accessKeyId.isNullOrEmpty() ||
                secretKeyId.isNullOrEmpty() || securityToken.isNullOrEmpty() ||
                bucketName.isNullOrEmpty() || uploadDir.isNullOrEmpty()
    }

    override fun toString(): String {
        return "OSSToken(endpoint=$endpoint, accessKeyId=$accessKeyId, secretKeyId=$secretKeyId, securityToken=$securityToken, bucketName=$bucketName, uploadDir=$uploadDir)"
    }


}

data class OSSUploadResult(val code:Int?=0,
                           val objectKey:String?=null,
                           val etag:String?=null,
                           val paramKey:String?=null,
                           val file: File?=null
                           )